DOpus (58/96)

From:Dave Clarke
Date:12 May 2001 at 03:23:08
Subject:[D5] Re: CDDA 2(+)

Once upon a time, 11-May-01 21:03:39, Javier de las Rivas spoke thus about
'[D5] CDDA 2':

>hi, just dl secondspin is a gui for mp3 encoding ok it's something
>unstable, but i found 2 little progs thath maybe are useful.

>...

[chop]

>dont' know how to parse ShowTOC adn how to get the CDDA process number so
>i can abort it when clickin on Abort

Do what I do for Play16 and ConciertoMPEGPlay, download BreakName from Aminet
and make a button:

AmigaDOS BreakName CDDA

or just use the C:Status command:

status COM=CDDA

This will return the process number.

>more ideas, suggestions?

Here's just a modified RCDPlay.dopus5 script, (originally written to use
gcdplay on a remote Linux machine).

There's a total of 176 lines including blanks, so if you've got more
something's been wrapped.

I can't use CDDA on my CD-ROM, (DAE not supported), so just change the
command parameters to suit. Uses ShowTOC, (Aminet), to get the CD contents -
supporting CDID if you specify a directory.

It supports sending a play list to the play command, each track number
seperated by a comma, eg. track, track, track, etc, etc. Could easily be
changed.

CD Title is in the Lister titlebar, number of tracks and total length in the
status bar.

Have fun :)

BTW, if you want to do something interesting to it, get it to look up CDDB if
it can't identify the CD and you're connected to the internet...fairly simple
to implement ;^)
------------------------8<-----------------------
/*
$VER: CDDAPlay.dopus5 0.1 (11.5.01)

Based upon RCDPlay.dopus5 0.6

Call as:
---------------------------------------------
ARexx DOpus5:ARexx/CDDAPlay.dopus5 {Qp}
---------------------------------------------

Double-click on an entry or use pop-up menu.

*/

device = 'cybppc.device' /* CD device */
unit = '6' /* CD unit */
cdid = 'CDID:' /* Directory where CDID's are */
cdplay = 'CDDA' /* Command to play CD tracks */
/* Format sent to 'cdplay' command is: 'cdplay' <track[,track,track,...]> */
winpos = '850/40/400/300' /* Position where lister will open */

if cdid = '' then
cdlist = 'ShowTOC DEVICE='device' UNIT='unit
else
cdlist = 'ShowTOC DEVICE='device' UNIT='unit' CDIDDIR='cdid
cdlist = cdlist||' HEADFORMAT="%N|%f|%T" FORMAT="%n|%d|%t" TAILFORMAT=""'

cdtf = 'T:cd-list'

options results
signal on syntax
signal on halt
signal on break_c

trak. = ''
song. = 'CDID not available'
lctn. = ''
plist = ''

parse arg port .
address value port

if ~show('L','rexxsupport.library') then call addlib('rexxsupport.library', 0, -30)

call GetTracks
call SetHandler
call SetLister
call LoadLister
call LoopDeLoop

syntax:
halt:
break_c:
dopus remtrap '*' myhandler
dopus command "Reload" temp remove
call closeport(myhandler)
if event ~= 'inactive' then lister set CDHandle busy off
if exists(cdtf) then call delete(cdtf)
exit

ErrorHandler: PROCEDURE EXPOSE cdtf
ErrorText = arg(1)
dopus request '"'||ErrorText||'" OK'
if exists(cdtf) then call delete(cdtf)
exit 20
return

GetTracks:
address command cdlist '>' cdtf

if ~open('infile',cdtf,R) then call ErrorHandler("Couldn''t open CD list file: ("||cdtf||")")

i = 0
lsong = 0
cdstat = readln('infile')
do while ~eof('infile')
inline = readln('infile')
if left(inline,5) ~= 'TRACK' & inline ~= '' then do
i = i + 1
parse var inline trak.i'|'lctn.i'|'songname
if songname ~= '' then song.i = strip(songname)
if lsong < length(song.i) then lsong = length(song.i)
end
if left(inline,5) = 'TRACK' then do
parse var inline with 7 trk +2 51 ltn +8
trk = strip(trk,'l','0')
lctn.trk = ltn
end
end
call close('infile')
trak.0 = i

parse var cdstat tottrks'|'tottime'|'cdname
if cdname = '' then cdname = 'Unknown'
return

SetHandler:
call forbid()
myhandler = "RCDhandler.0"
do i = 0 while show("p",myhandler)
myhandler = "RCDhandler."i
end
if ~openport(myhandler) then do
call permit()
call ErrorHandler('RCDLister: Could not open message port')
exit
end
call permit()
return

LoadLister:
lister set CDHandle header 'Tracks: 'tottrks' Time: 'tottime
popup.COUNT = 5
popup.0 = 'Play'
popup.1 = 'Add to list'
popup.2 = 'Play list'
popup.3 = '---'
popup.4 = 'Clear list'
match.MENU = popup.

do i = 1 to trak.0
match.NAME = trak.i
match.DISPLAY = right(trak.i,2,'0')||' '||overlay(song.i,copies(' ',lsong + 5))||lctn.i
lister addstem CDHandle match.
lister refresh CDHandle
end

lister set CDHandle busy off
lister refresh CDHandle FULL
return

SetLister:
lister new winpos
CDHandle = result
lister set CDHandle busy on
lister set CDHandle toolbar 0
lister set CDHandle display name
lister set CDHandle label 'CDPlay'
lister set CDHandle title cdname
lister set CDHandle handler myhandler
lister set CDHandle field 0 Track
lister set CDHandle path ''
lister refresh CDHandle FULL

dopus command "Reload" temp private handler

dopus addtrap "Reload" myhandler
return

LoopDeLoop:
do forever
if waitpkt(myhandler) then do
packet = getpkt(myhandler)
if packet ~= '00000000'x then do
event = getarg(packet,0)
fname = getarg(packet,2)
arg3 = getarg(packet,3)
select
when event = 'inactive' then leave
when event = 'doubleclick' | (event = 'menu' & arg3 = 0) then address command cdplay fname
when event = 'menu' & arg3 = 1 then plist = strip(plist||','||fname,,',')
when event = 'menu' & arg3 = 2 then address command cdplay' 'plist
when event = 'menu' & arg3 = 4 then plist = ''
when event = 'Reload' then do
lister clear CDHandle
lister refresh CDHandle
call GetTracks
call LoadLister
end
otherwise lister request CDHandle '"Unrecognised command" OK'
end
end
call reply(packet,0)
end
end
return
------------------------8<-----------------------

Dave



_--_|\ Dave Clarke | Four Wheel Drive: - Helps you get stuck |
/ \ | faster, harder, further from help.|
\_.--.*/ <-Melbourne | Powered by: A3000 '060/50+604/180 138MB |
v bj73@cryogen.com | P-IV/Concierto/Pablo/Paloma |


Hymie! Park the car and come kiss your son the sex gargoyle hello!



Email majordomo@lss.com.au with 'help' in the body for help.
Members posting binaries to the mailing list will be removed!